//
//  NSString+MyNSString.h
//  JHLNHV2
//
//  Created by macbook-air on 15/5/13.
//  Copyright (c) 2015年 macbook-air. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface NSString (KNAddtion)

+ (BOOL)KNIsNullOrEmpty:(NSString *)string;
+ (NSString *)KNTimeStringFromInterval:(long)interval;
- (NSString *)KNURLEncodedString;

- (NSString *)KNTrim;
- (NSString *)KNFormatPhoneNum:(NSString *)phone;
- (NSString *)KNGetLastStrByLengh:(NSUInteger)len;
+ (BOOL)KNIsPhone:(NSString *)phone;
+ (BOOL)KNIsIDCardNumber:(NSString *)text;
+ (BOOL)KNIsDecimal:(NSString *)inputString;
- (BOOL)KNIsAllNumber;
- (BOOL)KNIsAllChars;

/*车牌号验证 MODIFIED BY HELENSONG*/
+ (BOOL)KNValidateCarNo:(NSString *)carNumber;
+ (NSString *)KNStringByRemovingControlCharacters: (NSString *)inputString;
+ (NSString *)KNGetTypeByLevel:(int)level;
+ (BOOL)KNIsValidMoney:(NSString *)string;
+ (NSString *)KNGetDateStringWithSecond:(BOOL)withSecond byTimeInterval:(double)timeInterval;

- (NSString *)KNSafeSubstringWithRange:(NSRange)range;

- (NSString *)KNDeleteAllSpicalChar:(NSString *)spicalChar;

- (NSDictionary *)KNUrlQueryStringToDict;

/**
 *  MD5加密字符串
 *
 *  @param str 被加密的字符串
 *
 *  @return 加密后的字符串
 */
+ (NSString*)KNMd5Str:(NSString*)str;

- (NSString *)KNMd5;

+ (NSMutableAttributedString *)KNRenderString:(NSString *)renderString withColor:(UIColor *)renderColor;
+ (NSMutableAttributedString *)KNRenderString:(NSString *)renderString withColor:(UIColor *)renderColor font:(UIFont *)font;
- (NSMutableAttributedString *)KNRenderString:(NSString *)renderString withColor:(UIColor *)renderColor;
- (NSMutableAttributedString *)KNRenderString:(NSString *)renderString withColor:(UIColor *)renderColor font:(UIFont *)font;

- (CGFloat)KNGetHeightWithMaxWidth:(CGFloat)width font:(UIFont *)font;

+ (CGFloat)KNGetHeightForAttributedStringWithAttributedString:(NSAttributedString *)string width:(CGFloat)width;

/**
 *  生成32位UUID
 */
+ (NSString *)KNUUIDString;
@end

